<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@include file="/common/common.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>添加新闻</title>
		<link rel="stylesheet" href="../style/drp.css">
		<script src="../script/client_validate.js"></script>
		<script charset="utf-8" src="/editor/kindeditor.js"></script>
		<script charset="utf-8" src="/editor/lang/zh_CN.js"></script>
		<script>
		/* var options = {
		        cssPath : '/css/index.css',
		        filterMode : true
		};
		var editor = K.create('textarea[name="content"]', options); */

        var editor;
		KindEditor.ready(function(K) {
				editor = K.create('#editor_id', {
				//cssPath : '../plugins/code/prettify.css',
				uploadJson : 'editor/jsp/upload_json.jsp',
				fileManagerJson : 'editor/jsp/file_manager_json.jsp',
				//allowFileManager : true,
				/* afterCreate : function() {
					var self = this;
					K.ctrl(document, 13, function() {
						self.sync();
						document.forms['example'].submit();
					});
					K.ctrl(self.edit.doc, 13, function() {
						self.sync();
						document.forms['example'].submit();
					});
				} */
			});
			prettyPrint();
		});
       /*  KindEditor.ready(function(K) {
            K.create('#editor_id', {
            	uploadJson : basePath + 'jsp/upload_json.jsp',
            	fileManagerJson : basePath + 'jsp/file_manager_json.jsp'
            });
    	}); */
        
     // 取得HTML内容
        html = editor.html();

        // 同步数据后可以直接取得textarea的value
        editor.sync();
        html = document.getElementById('editor_id').value; // 原生API
        html = K('#editor_id').val(); // KindEditor Node API
        html = $('#editor_id').val(); // jQuery

        // 设置HTML内容
        editor.html('${news.content}');

		</script>

	</head>

	<body class="body1">
		<form name="userForm" target="_self" action="/news!add.action" id="userForm">
			<div align="center">
				<table width="95%" border="0" cellspacing="2" cellpadding="2">
					<tr>
						<td>&nbsp;
							
						</td>
					</tr>
				</table>
				<table width="95%" border="0" cellspacing="0" cellpadding="0"
					height="25">
					<tr>
						<td width="522" class="p1" height="25" nowrap>
							<img src="../images/mark_arrow_03.gif" width="14" height="14">
							&nbsp;
							<b>系统管理&gt;&gt;用户维护&gt;&gt;添加</b>
						</td>
					</tr>
				</table>
				<hr width="97%" align="center" size=0>
				<table width="95%" border="0" cellpadding="0" cellspacing="0">
					
					</tr>
					<tr>
						<td height="26">
							<div align="right">
								<font color="#FF0000">*</font>新闻标题:&nbsp;
							</div>
						</td>
						<td>
							<input name="news.title" type="text" class="text1"  id="title"
								size="20" maxlength="30" value="${news.title }">
							<input name="news.id" type="hidden" value="${news.id}">
						</td>
					</tr>
					
					<tr>
						<td height="26">
							<div align="right">
								新闻内容:&nbsp;
							</div>
						</td>
						<td>
						<%-- <textarea name="news.content" rows="10" cols="40"  id="content" class="text1" >${news.content}</textarea> --%>
						<textarea id="editor_id" name="news.content" style="width:700px;height:300px;">&lt;strong&gt;${news.content}&lt;/strong&gt;</textarea>
						
						</td>
					</tr>
					<tr>
						<td height="26">
							<div align="right">
								所属类型:&nbsp;
							</div>
						</td>
						<td>
							<select name="news.type.id"  class="text1" id="typeId">
								<c:forEach items="${list}" var = "type">
								 <option value ="${type.id}">${type.name }</option>
								 </c:forEach>
							</select>
						</td>
					</tr>
				</table>
				<hr width="97%" align="center" size=0>
				<div align="center">
					<input  class="button1" type="submit"	value="添加" >
					&nbsp;&nbsp;&nbsp;&nbsp;
					<input  class="button1" type="button" value="返回" onClick="window.close()" />
				</div>
			</div>
		</form>
	</body>
</html>

